package com.netpace.iem.ahmed.model;

// Generated Dec 30, 2013 11:52:21 AM by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Income generated by hbm2java
 */
@Entity
@Table(name = "income", catalog = "iem")
public class Income implements java.io.Serializable {

	private Integer id;
	private Category category;
	private Double amount;
	private Date date;
	private Set<Label> labels = new HashSet<Label>(0);

	public Income() {
	}

	public Income(Category category, Double amount, Date date, Set<Label> labels) {
		this.category = category;
		this.amount = amount;
		this.date = date;
		this.labels = labels;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "category_id")
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "amount", precision = 22, scale = 0)
	public Double getAmount() {
		return this.amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "date", length = 10)
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "income_labels", catalog = "iem", joinColumns = { @JoinColumn(name = "income_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "label_id", nullable = false, updatable = false) })
	public Set<Label> getLabels() {
		return this.labels;
	}

	public void setLabels(Set<Label> labels) {
		this.labels = labels;
	}

}
